﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SearchProperty.aspx.cs"  Inherits="FreeProperty.Views.Main.SearchProperty" %>

<form id="frmContent" runat="server">
<div id="MainContainer">
    <h2>
        Search Property</h2>
    <asp:hiddenfield id="hdnPageCount" runat="server" />
    <asp:hiddenfield id="hdnCurrentPage" runat="server" />
    <asp:hiddenfield id="hdnSelectedPane" runat="server" />
    <asp:hiddenfield id="hdnStatus" runat="server" />
    <asp:hiddenfield id="hdnMode" runat="server" />
    <div>
        <div>
            Search property as per your requirements.</div>
    </div>
    <div>
        <span class="span">Property Type</span>
        <%--<div>
            Specify Property Type.</div>
        <br />--%>
        <table width="100%">
            <tr>
                <td class="colortxt" style="width:15%">
                    Property Type:
                </td>
                <td style="width:25%">
                    <asp:dropdownlist id="ddlPropertyType" runat="server">               
                </asp:dropdownlist>
                </td>
                <td class="colortxt" style="width:15%">
                    Usage Type:
                </td>
                <td style="width:25%">
                    <asp:dropdownlist id="ddlPurpose" runat="server">               
                </asp:dropdownlist>
                </td>
            </tr>
            <tr>
                <td class="colortxt">
                    State:
                </td>
                <td>
                    <asp:dropdownlist id="ddlState" onchange="javascript:return LoadDistrict('Views/Main/SearchProperty.aspx')"
                        runat="server">               
                </asp:dropdownlist>
                </td>
                <td class="colortxt">
                    City:
                </td>
                <td>
                    <asp:dropdownlist id="ddlDistrict" runat="server">               
                </asp:dropdownlist>
                </td>
            </tr>
            
        </table>
    </div>
    <div>
        <span class="span">Specify location and price range </span>
        
        <table width="100%">
            <tr>
                <td class="colorTxt" style="width:15%">
                    Price:
                </td>
                <td class="SmallTxt">
                    <asp:textbox runat="server" maxlength="15" width="80px" id="tbMin"
                        onblur="extractNumber(this,2,false);" onkeyup="extractNumber(this,2,false);"
                        onkeypress="return blockNonNumbers(this, event, true, false);"></asp:textbox>(Min)&nbsp;-
                   <asp:textbox runat="server" maxlength="15" width="80px" id="tbMax"
                        onblur="extractNumber(this,2,false);" onkeyup="extractNumber(this,2,false);"
                        onkeypress="return blockNonNumbers(this, event, true, false);"></asp:textbox>(Max)
                </td>
            </tr>
            <tr>
                <td class="colorTxt">
                    Location:
                </td>
                <td class="SmallTxt">
                    <input type="text" runat="server" style="width:205px" maxlength="20" id="tbLocation" />&nbsp;(Type or select from Auto suggest)
                </td>
            </tr>
        </table>
    </div>
    <div>
        <table style="width: 100%">
            <tr>
                <td style="width: 70%">
                    <asp:label id="lblResult" cssclass="error" runat="server"></asp:label>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td>
                    <div>
                        <asp:label id="lblError" cssclass="error" runat="server"></asp:label>
                        <div class="error_message">
                        </div>
                        <asp:label runat="server" id="lblSpace" width="200px"></asp:label>
                        <input type="button" class="button" value="Find" onclick="javascript:return ValidateSearch('Views/Main/SearchProperty.aspx')" />
                    </div>
                </td>
            </tr>
        </table>
        <asp:gridview id="grdSearchResults" runat="server" cssclass="gridTable" autogeneratecolumns="False"
            cellpadding="4" gridlines="None" onrowdatabound="grdSearchResults_RowDataBound">
                <Columns>
                
                <asp:BoundField HeaderText="Sr. No." DataField="SerialNumber" />
                    <asp:BoundField HeaderText="Rent" DataField="Price" />
                    <asp:BoundField HeaderText="Location" DataField="Location" />
                    <asp:BoundField HeaderText="Address" DataField="Address" />
                    <asp:BoundField HeaderText="Details" DataField="PropertyDescription" />
                     <asp:TemplateField HeaderText="Contact Details">
                    <ItemTemplate>
                        Name:<asp:Label ID="lblContactName" runat="server" Text='<%#Bind("Name") %>'></asp:Label><br />
                        Contact No: <asp:Label ID="lblContactNo" runat="server" Text='<%#Bind("ContactNo") %>'></asp:Label><br />
                        Email ID:<asp:Label ID="lblEmailId" runat="server" Text='<%#Bind("EmailId")%>'></asp:Label><br />
                        Preferred Time:<asp:Label ID="lblPreferredTime" runat="server" Text='<%#Bind("PreferredTime") %>'></asp:Label><br />
                    </ItemTemplate>
                </asp:TemplateField>
                </Columns>
                <HeaderStyle CssClass="gridHeader" />
                <RowStyle CssClass="gridTable" />
                <AlternatingRowStyle CssClass="altRow" />
            </asp:gridview>
        <table style="width: 100%">
            <tr>
                <td align="right">
                    <div id="divPageNoFooter" class="pages" runat="server">
                        <span><a href="" runat="server" style="cursor: hand" id="lnkFootFirst" class="first">
                            First</a></span> <span><a style="cursor: hand" runat="server" id="lnkFootPrevious"
                                href="" class="previous">Prev</a></span> <span id="spanFootServerPaging" runat="server"
                                    class="nums"></span><span><a href="" runat="server" style="cursor: hand" id="lnkFootNext"
                                        class="next">Next</a></span> <span><a href="" runat="server" id="lnkFootLast" style="cursor: hand"
                                            class="last">Last</a></span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>
</form>
<script type="text/javascript">

    $("#tbLocation").autocomplete("Views/Main/LocationSuggest.ashx?", {
        extraParams: {
            did: function () { return $("#ddlDistrict").attr('value'); }
        },
        delay: 200,
        selectOnly: true,
        cacheLength: 0,
        autoFill: true,
        matchSubset: true,
        minChars: 1
    });
    
</script>
